uni.addInterceptor('request', {
	invoke: (options) => {
		console.log(options,'options-------')
		// 拦截前触发
		options.timeout = 10000
		options.header = {
			...options.header,
			"discountId": Date.now()
		}
	},
	success: (res) => {
		// 提取核心数据、添加支持泛型
	},
	fail: () => {
		// 1。网络错误：提示用户换网络 2. 401错误，清除用户信息，跳转到登录页
	}
})

export const http = (options) => {
	return new Promise((resolve, reject) => {
		uni.request({
			...options,
			success: (res) => {
				console.log('10086')
				resolve(res)
			},
			fail: (err) => {
			console.log('10087')
				reject(err)
			}
		})
	})
}